import grails.converters.*

class TaskController {

    //def index = { }

    def xmlList = {
        render Task.list() as XML   
    }

    def xmlShow = {
        render Task.get(params.id) as XML
    }

//    def index = {
//        switch (request.method) {
//            case 'POST': 
//                //render "Create\n"
//                def task = new Task()
//                
//                
//                
//                
//                task.completed = request.XML.completed
//                //task.createDate = new Date().parse("yyyy-M-d H:m", request.XML.@createDate)
//                task.createDate = new Date()
//                task.description = request.XML.description
//                //task.finish = new Date().parse("yyyy-M-d H:m", request.XML.@finish)
//                task.finish = new Date()
//                task.generation = request.XML.generation
//                task.name = request.XML.name
//                task.teamOverhead = request.XML.teamOverhead
//                task.work = request.XML.work
//
//                if (task.save()) {
//                    response.status = 201
//                    render task as XML
//                }
//                else {
//                    response.status = 500
//                    render "Could not save task due to errors: {$task.errors}"
//                }
//                break
//            case 'GET': //GET method is for retrieving data
//                //render "Retrieve\n"
//                if (params.id) { render Task.get(params.id) as XML }
//                else { render Task.list() as XML }
//                break
//            case 'PUT':
//                render "Update\n"
//                break
//            case 'DELETE':
//                render "Delete\n"
//                break    
//        }    
//    }


}
